<?php
include_once 'fns.php';
include_once 'admin_html.php';
include_once 'view.php';
include_once 'valid_fns.php';

if (isset($_GET['org'])) $id_org=$_GET['org'];
else $id_org=NULL;

if (isset($_GET['dep'])) $id_dep=$_GET['dep'];
else $id_dep=NULL;

if (isset($_GET['let'])) $id_let=$_GET['let'];
else $id_let=NULL;

if (isset($_GET['globalsearch'])) $globalsearch=$_GET['globalsearch'];
else $globalsearch=NULL;

if (isset($_GET['action'])) $action=$_GET['action'];
else $action=NULL;



$tel_ood[]=$id_org;
$tel_ood[]=$id_dep;
$tel_ood[]=  get_tel_org_or_dep($id_dep, $id_org);
$tel_ood[]= formated_tel(get_tel_org_or_dep(0, $id_org));

$name_org=applogic_name_org(get_org($id_org),$tel_ood);
$view=PB_View::getInstance($id_let, $globalsearch, $tel_ood);
if ($action=='pdf') {
    include_once 'pdf.php';
    $view->create_pdf();
    exit;
}
session_start();
display_header('Телефонный справочник Алтайские закрома');

global $admin_mod;
if (check_valid_user() && check_valid_session()){
    $admin_mod=TRUE;
    echo "<a href=\"logout.php\" class=\"btn logout\">Выход</a>";
}
display_content('<h4>Телефонный справочник Алтайские закрома</h4>');
display_form_global_search(/*modify_emp_tel_array(get_emp_tel_w_dep(0,0))*/FALSE,$globalsearch);

$view->pb_view_content();
display_footer();

?>
